home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cgraphix / kheader.c < prev    next >
Text File  |  1986-05-07  |  2KB  |  110 lines

  1. /* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
  2. #include    <stdio.h>
  3. #define    EXTERN    extern
  4. #include    <typedef.h>
  5.  
  6.  
  7. void SetHeaderOn()
  8. {
  9.     HeaderGlb = TRUE;
  10. }
  11.  
  12.  
  13. void SetHeaderOff()
  14. {
  15.     HeaderGlb = FALSE;
  16. }
  17.  
  18.  
  19. void SetHeaderToTop()
  20. {
  21.     TopGlb = TRUE;
  22. }
  23.  
  24.  
  25. void SetHeaderToBottom()
  26. {
  27.     TopGlb = FALSE;
  28. }
  29.  
  30.  
  31. void RemoveHeader(i)
  32. int        i;
  33. {
  34.     if ((1 <= i) && (MaxWindowsGlb >= i)) {
  35.         window[i].drawn = FALSE;
  36.         window[i].top = TRUE;
  37.         *(window[i].header) = EOS;
  38.     }
  39.     else
  40.         error(22, 2);
  41. }
  42.  
  43.  
  44. void DefineHeader(i, hdr)
  45. int            i;
  46. char        *hdr;
  47. {
  48.     if ((1 <= i) && (i <= MaxWindowsGlb))
  49.         strcpy(window[i].header, hdr);
  50.     else
  51.         error(3,2);
  52. }
  53.  
  54.  
  55. static void DrawHeaderBackground(y1, y2, xl1, xl2)
  56. int        y1, y2;
  57. int        xl1, xl2;
  58. {
  59.     int        i;
  60.  
  61.     for (i = y1; i <= y2; i++)
  62.         DrawStraight(xl1 , xl2, i);
  63. }
  64.  
  65.  
  66. void DrawHeader(xl1, xl2)
  67. int        xl1, xl2;
  68. {
  69.     int        Y1Hdr, Y2Hdr, yl1, yl2;
  70.  
  71.     if (window[WindowNdxGlb].drawn) {
  72.         if (window[WindowNdxGlb].top) {
  73.             ReDefineWindow(WindowNdxGlb, X1RefGlb, Y1RefGlb - HeaderSizeGlb,
  74.                 X2RefGlb, Y2RefGlb);
  75.             SelectWindow(WindowNdxGlb);
  76.         }
  77.         else {
  78.             ReDefineWindow(WindowNdxGlb, X1RefGlb, Y1RefGlb, X2RefGlb,
  79.                 Y2RefGlb + HeaderSizeGlb);
  80.             SelectWindow(WindowNdxGlb);
  81.         }
  82.     }
  83.     if (TopGlb) {
  84.         yl1 = Y1RefGlb+HeaderSizeGlb;
  85.         yl2 = Y2RefGlb;
  86.         Y1Hdr = Y1RefGlb;
  87.         Y2Hdr = Y1RefGlb+HeaderSizeGlb-1;
  88.     }
  89.     else {
  90.         yl1 = Y1RefGlb;
  91.         yl2 = Y2RefGlb-HeaderSizeGlb;
  92.         Y1Hdr = Y2RefGlb-HeaderSizeGlb+1;
  93.         Y2Hdr = Y2RefGlb;
  94.     }
  95.     window[WindowNdxGlb].top = TopGlb;
  96.     ReDefineWindow(WindowNdxGlb,X1RefGlb,yl1,X2RefGlb,yl2);
  97.     SelectWindow(WindowNdxGlb);
  98.     DrawHeaderBackground(Y1Hdr, Y2Hdr, xl1, xl2);
  99.     ColorGlb = 255-ColorGlb;
  100.     DrawText(xl1+2+(xl2-xl1-strlen(window[WindowNdxGlb].header)*6) / 2,
  101.         Y1Hdr+3,1,window[WindowNdxGlb].header);
  102.     DrawSquare((double)xl1, (double)Y1Hdr, (double)xl2, (double)Y2Hdr,
  103.         FALSE);
  104.     ColorGlb = 255-ColorGlb;
  105.     DrawSquare((double)xl1, (double)Y1RefGlb, (double)xl2,
  106.         (double)Y2RefGlb, FALSE);
  107.     window[WindowNdxGlb].drawn = TRUE;
  108. }
  109.  
  110.